import { createRouter, createWebHashHistory } from 'vue-router'
import example from './modules/example'

export const constantRoutes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'Login',
    meta: {title: '登陆', keepAlive: false}
  },
  {
    path: '/:cathchAll(.*)',
    component: () => import('@/views/error-page/404.vue'),
    name: '404',
    meta: {title: '页面未找到', keepAlive: false}
  },
  ...example
]

const router = createRouter({
  history: createWebHashHistory(),
  scrollBehavior: () => ({ top: 0 }),
  routes: constantRoutes
})

export default router
